package net.bingosoft.common.exception;

import org.apache.commons.lang.StringUtils;

/**
 * 2007-8-9 上午10:59:02
 * Author:yangdongyu(yangdy@bingosoft.net)
 * ReadMe:通用的业务异常
 * ChangeLog:1.版本初建
 */
public class BusinessException extends Exception {

	private static final long serialVersionUID = 1L;
	private String code = "";
	private String localMsg = "";
	
	/**
	 * @param msg
	 */
	public BusinessException(String code) {
		super(code);
		this.code = code;
	}
    /**
     * 
     * @param msg 异常的详细信息
     * @param code 异常代码,例如可以使用模块名称作为异常代码
     */
	public BusinessException(String code,String msg) {
		super(msg);
		this.code = code;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getLocalizedMessage(){
		if(StringUtils.isNotEmpty(localMsg)){
			return localMsg;
		}else{
			return super.getLocalizedMessage();
		}
	}
	public void setLocalizedMessage(String localizedMessage){
		this.localMsg = localizedMessage;
	}
	
	

}
